home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Interactive Web Graphics with Shout 3D
/
Interactive Web Graphics With Shout 3D.iso
/
pc
/
Code
/
Chapter09
/
ChangeScenesPanel.java
< prev
next >
Wrap
Text File
|
2000-08-29
|
1KB
|
70 lines
package applets;
import shout3d.*;
import shout3d.core.*;
import shout3d.math.*;
public class ChangeScenesPanel extends Shout3DPanel implements DeviceObserver{
//must create an array (list) of URLs,
// even though there is only one URL in the array
String[] URL = new String[1];
Transform ratpack;
Transform modswing;
boolean mod = true;
public ChangeScenesPanel(Shout3DApplet applet){
super(applet);
}
public void customInitialize () {
addDeviceObserver(this,"MouseInput", null);
URL[0] = "models/ratpack2.s3d";
ratpack = new Transform();
loadURL(URL, ratpack);
modswing = (Transform) getScene();
}
protected void finalize() {
removeDeviceObserver(this,"MouseInput");
}
public boolean onDeviceInput(DeviceInput di, Object userData) {
MouseInput mi = (MouseInput) di;
switch (mi.which){
case MouseInput.DOWN:
if(mod) {
setScene(ratpack);
mod = false;
return true;
}
else {
setScene(modswing);
mod = true;
return true;
}
}//end of switch
return false;
}
}